/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.kj.entity;

import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.utils.excel.annotation.ExcelField;
import com.jeesite.common.utils.excel.annotation.ExcelFields;
import com.jeesite.common.utils.excel.fieldtype.FieldType;
import com.jeesite.common.utils.excel.fieldtype.OfficeType;
import com.jeesite.modules.kj.utils.KjMemberUtil;
import com.jeesite.modules.kj.utils.SkillUtil;
import com.jeesite.modules.sys.entity.Area;
import com.jeesite.modules.sys.entity.Company;
import com.jeesite.modules.sys.entity.Office;
import org.hibernate.validator.constraints.Length;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

import com.jeesite.common.utils.excel.annotation.ExcelField;
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
import com.jeesite.common.utils.excel.annotation.ExcelFields;
import javax.validation.Valid;

/**
 * kj_memberEntity
 * @author hzy
 * @version 2021-07-04
 */
@Table(name="kj_member", alias="a", columns={
		@Column(name="id", attrName="id", label="id", isPK=true),
		@Column(name="name", attrName="name", label="name", queryType=QueryType.LIKE),
		@Column(name="nickname", attrName="nickname", label="nickname"),
		@Column(name="birthday", attrName="birthday", label="birthday"),
		@Column(name="mobile", attrName="mobile", label="mobile", queryType=QueryType.LIKE),
		@Column(name="member_type", attrName="memberType", label="member_type"),
		@Column(name="address", attrName="address", label="address", queryType=QueryType.LIKE),
		@Column(includeEntity=DataEntity.class),
		@Column(name="member_no", attrName="memberNo", label="会员卡号", queryType = QueryType.LIKE),
		@Column(name="volunteer_no", attrName="volunteerNo", label="志愿者号"),
		@Column(name="wxopenid", attrName="wxopenid", label="wxopenid"),
		@Column(name="headimg", attrName="headimg", label="headimg"),
		@Column(name="idcard", attrName="idcard", label="idcard"),
		@Column(name="email", attrName="email", label="email"),
		@Column(name="skill", attrName="skill", label="skill"),
		@Column(name="foundation_no", attrName="foundationNo", label="内部志愿者编号"),
		@Column(name="document_type", attrName="documentType", label="证件类型"),
	}, joinTable={
		@JoinTable(type= JoinTable.Type.LEFT_JOIN, entity= KjMemberIntegrals.class, alias="o",
				on="o.member_id = a.id",
				columns={@Column(includeEntity=KjMemberIntegrals.class)}),
}, orderBy="a.update_date DESC"
)
public class KjMember extends DataEntity<KjMember> {

	private static final long serialVersionUID = 1L;
	private String name;		// name
	private String nickname;		// nickname
	private String birthday;		// birthday
	private String mobile;		// mobile
	private String memberType;		// member_type
	private String address;		// address
	private String memberNo;		// 会员卡号
	private String wxopenid;		// wxopenid
	private String headimg;		// headimg
	private String volunteerNo;
	private String email;
	private String idcard;
	private String skill;
	private String foundationNo;
	private String documentType;
	private KjMemberIntegrals kjMemberIntegrals;
	private String skillStr;

	public KjMember() {
		this(null);
	}

	public KjMember(String id){
		super(id);
	}

	@Valid
	@ExcelFields({
			@ExcelField(title="姓名", attrName="name", align=Align.CENTER, sort=35),
			@ExcelField(title="手机", attrName="mobile", align= Align.CENTER, sort=50),
			@ExcelField(title="生日", attrName="birthday", align=Align.CENTER, sort=55),
			@ExcelField(title="证件类型", attrName="documentType", dictType = "document_type", align=Align.CENTER, sort=60),
			@ExcelField(title="证件号", attrName="idcard", align=Align.CENTER, sort=65),
			@ExcelField(title="是否中兴员工", attrName="memberType", dictType = "sys_yes_no", align=Align.CENTER, sort=75),
			@ExcelField(title="中兴员工工号", attrName="memberNo", sort=80, width = 25*256),
			@ExcelField(title="邮箱", attrName="email", sort=81, width = 25*256),
			@ExcelField(title="常驻地", attrName="address", sort=82, width = 25*256),
			@ExcelField(title="特长", attrName="skillStr", sort=83, width = 25*256),
			@ExcelField(title="志愿者编号", attrName="volunteerNo", align=Align.CENTER, sort=85),
			@ExcelField(title="总积分", attrName="kjMemberIntegrals.totalIntegrals", align=Align.CENTER, sort=86),
			@ExcelField(title="总时长", attrName="kjMemberIntegrals.totalHours", align=Align.CENTER, sort=87),
			@ExcelField(title="已使用积分", attrName="kjMemberIntegrals.usedIntegrals", align=Align.CENTER, sort=88),
			@ExcelField(title="注册时间", attrName="createDate", dataFormat = "yyyy-MM-dd", align=Align.CENTER, sort=89),
			@ExcelField(title="状态", attrName="status", dictType = "sys_status", align=Align.CENTER, sort=90),
	})
	@Length(min=0, max=255, message="name长度不能超过 255 个字符")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Length(min=0, max=255, message="nickname长度不能超过 255 个字符")
	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	@Length(min=0, max=255, message="birthday长度不能超过 255 个字符")
	public String getBirthday() {
		return birthday;
	}

	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}

	@Length(min=0, max=11, message="mobile长度不能超过 11 个字符")
	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	@Length(min=0, max=1, message="member_type长度不能超过 1 个字符")
	public String getMemberType() {
		return memberType;
	}

	public void setMemberType(String memberType) {
		this.memberType = memberType;
	}

	@Length(min=0, max=255, message="address长度不能超过 255 个字符")
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Length(min=0, max=10, message="会员卡号长度不能超过 10 个字符")
	public String getMemberNo() {
		return memberNo;
	}

	public void setMemberNo(String memberNo) {
		this.memberNo = memberNo;
	}

	@Length(min=0, max=64, message="wxopenid长度不能超过 64 个字符")
	public String getWxopenid() {
		return wxopenid;
	}

	public void setWxopenid(String wxopenid) {
		this.wxopenid = wxopenid;
	}

	@Length(min=0, max=255, message="headimg长度不能超过 255 个字符")
	public String getHeadimg() {
		return headimg;
	}

	public void setHeadimg(String headimg) {
		this.headimg = headimg;
	}

	public String getVolunteerNo() {
		return volunteerNo;
	}

	public void setVolunteerNo(String volunteerNo) {
		this.volunteerNo = volunteerNo;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getIdcard() {
		return idcard;
	}

	public void setIdcard(String idcard) {
		this.idcard = idcard;
	}

	public String getSkill() {
		return skill;
	}

	public void setSkill(String skill) {
		this.skill = skill;
	}

	public String getFoundationNo() {
		return foundationNo;
	}

	public void setFoundationNo(String foundationNo) {
		this.foundationNo = foundationNo;
	}

	public String getDocumentType() {
		return documentType;
	}

	public void setDocumentType(String documentType) {
		this.documentType = documentType;
	}

	public KjMemberIntegrals getKjMemberIntegrals() {
//		if(kjMemberIntegrals == null){
//			kjMemberIntegrals = KjMemberUtil.getMemberIntegrals(this);
//		}
		return kjMemberIntegrals;
	}

	public void setKjMemberIntegrals(KjMemberIntegrals kjMemberIntegrals) {
		this.kjMemberIntegrals = kjMemberIntegrals;
	}

	public String getSkillStr() {
		if(this.getSkill() != null) {
			this.skillStr = SkillUtil.getSkills(this.getSkill());
		}
		return this.skillStr;
	}

	public void setSkillStr(String skillStr) {
		this.skillStr = skillStr;
	}
}
